package com.business_clean.ui.adapter.custom;

import android.view.View;
import android.widget.CheckBox;

import com.business_clean.R;
import com.business_clean.data.mode.project.ProjectMangerList;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;

public class CustomMangerNoPaddingAllAdapter extends BaseQuickAdapter<ProjectMangerList, BaseViewHolder> {

    private String uuid = "";

    public CustomMangerNoPaddingAllAdapter() {
        super(R.layout.item_custom_no_padding);
        addChildClickViewIds(R.id.ck_item_choose);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseDataBindingHolder, ProjectMangerList item) {
        baseDataBindingHolder.setText(R.id.tv_item_custom, item.getProject_short_name());
        baseDataBindingHolder.setText(R.id.tv_item_custom_sub, item.getProject_name());
        CheckBox checkBox = baseDataBindingHolder.getView(R.id.ck_item_choose);

        if (uuid.equals(item.getUuid())) {
            checkBox.setChecked(true);
        } else {
            checkBox.setChecked(false);
        }
    }

    public void updateChoose(String uuid) {
        this.uuid = uuid;
        notifyDataSetChanged();
    }

}
